package cn.icesun.comall.cybershoptest.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {
    @Bean(value = "defaultApi")
    public Docket defaultApi() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .description("defaultApiDoc")
                        .termsOfServiceUrl("https://icesun.cn")
                        .contact(new Contact("GodMeowIceSun", "https://icesun.cn", "icesun@icesun.cn"))
                        .version("0.1.0-snapshot")
                        .build())
                //分组名称
                .groupName("默认接口")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("cn.icesun.comall.cybershoptest"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }
}
